#define _CRT_SECURE_NO_WARNINGS
class Solution {
public:
    string sortSentence(string s) {
        vector<string> vs1(9);
        string tmp;
        string ret;
        int count = 0;
        for (int i = 0; i < s.size(); i++)
        {
            if (s[i] == ' ') continue;
            if (isdigit(s[i]))
            {
                vs1[s[i] - '0' - 1] = tmp;
                tmp.clear();
                count++;
            }
            else
            {
                tmp += s[i];
            }
        }
        for (int i = 0; i < count; i++)
        {
            if (i == 0) ret += vs1[i];
            else ret += " " + vs1[i];
        }
        return ret;
    }
};